<template>
  <div class="container">
     <Tab  style="position:fixed; background-color:#fff; z-index:999"/>
     <div style="height:55px"></div>
    <van-cell title="申请人" :value="approver_name"/>
    <van-cell title="申请时间" :value="apply_time"/>
    <!-- 物料列表     -->
    <van-list>
      <div v-for="item in goodlist" :key="item.id">
       <van-swipe-cell>
            <van-card
              :num="item.apply_num"
              :desc="item.product_type"
              :title="item.product_name"
            />
            <span class="type">{{item.wpg_name}}</span>
          </van-swipe-cell>
      </div>
    </van-list>
    <!-- 审核人 -->
    <van-cell title="审核人"/>
    <van-steps direction="vertical">
      <van-step style="height:80px; display:none;">
        <h4>【城市】物流状态1</h4>
        <p>2016-07-12 12:40</p>
      </van-step>
      <div v-for="item in data3" :key="item.id">
        <van-step>
          <h2>{{item.approver_name}}</h2>
            <img :src="item.signpath" alt="" style="width:70px;height:50px;position:absolute;top:40px;left:170px;" v-show="item.flag">
          <p>{{item.order_time}}</p>
          <span style="position:absolute;top:50%;right:30px">{{item.yesorno}}</span>
          <span>
            {{item.remarks}}
          </span>
        </van-step>
      </div>
    </van-steps>

    

    
    
  </div>
</template>
<script>
import axios from "axios";
import { getCookie } from "Utils/cookie";
import { Toast } from "vant";
import Tab from 'Comp/Tab'
export default {
  data() {
    return {
      list: [],
      approver_name: "",
      apply_time: "",
      show: false,
      reviewer: "",
      message: "",
      goodlist: [],
      data3: [],
      flag1: true,
      flag2: false,
      approver_id: ""
    };
  },
  components:{
    Tab,
  },
  methods: {
    onSelect(item) {
      // 默认情况下点击选项时不会自动收起
      // 可以通过 close-on-click-action 属性开启自动收起
      this.show = false;
      Toast(item.name);
      this.reviewer = item.name;
    },
    cancel() {
      axios({
        url: "/hrkc/Product/updateApplybywhether_end",
        method: "POST",
        params: {
          apply_id: this.list.apply_id,
          whether_end: "no"
        }
      }).then(res => {
        console.log(res);
          if(res.data.code == 0){
              this.$router.push('/history')
          }
      });
    },
  },
  mounted() {
    // console.log('data',JSON.parse(this.$route.query.data))
    this.list = JSON.parse(this.$route.query.data);

    //获取当前申请记录的所有信息
    axios({
      url: "/hrkc/Product/getApplyinformation",
      method: "POST",
      params: {
        org_no: getCookie("org_no"),
        apply_id: this.list.apply_id,
        whether_end: ""
      }
    })
      .then(res => {
        console.log('11111',res);
        this.approver_id = res.data.data1[0].approver_id;
        this.apply_time = res.data.data1[0].apply_time;
        this.message = res.data.data1[0].remarks;
        this.approver_name = res.data.data1[0].approver_name;
        this.goodlist = res.data.data2;
        this.data3 = res.data.data3;
        if (this.approver_id == getCookie("approver_id")) {
          this.flag2 = true;
          this.flag1 = false;
        }
      })
      .catch(error => Promise.reject(error));
  }
};

</script>
<style lang="scss" scoped>
.van-card {
  height: 90px;
}
.van-card__content {
  height: 70px;
}
.van-card__title {
  height: 30px;
  line-height: 30px;
  font-size: 15px;
}
.van-card__desc {
  height: 20px;
  line-height: 20px;
  font-size: 10px;
}
.van-card__num {
  margin-top: -80px;
  font-size: 10px;
}
.van-card__footer {
  margin-top: -60px;
}
.type{
position: absolute;
top:60px;
left:10px
}
.footer {
  position: relative;
  top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  .van-button {
    width: 150px;
  }
}
</style>
